package cookinmaddy.database.spod;
import cookinmaddy.model.Recipe;

class DBRecipeManager extends php.db.Manager<DBRecipe> 
{
	public function new() 
	{
		super(DBRecipe);
	}
  
    override function make( c : DBRecipe ) : Void 
	{
		trace("BEGIN");
		c.value = new Recipe();
		c.value.ID = c.rec_id;
		c.value.Name = c.rec_name;
		trace("END");
	}
  
    override function unmake( c : DBRecipe ) : Void 
	{
		trace("BEGIN");
		c.rec_id = c.value.ID;
		c.rec_name = c.value.Name;
		trace("END");
	}	
	
  public function allRecipes() : List<Recipe>
  {
	  trace("BEGIN");
	  var list : List<Recipe> = new List<Recipe>();
	  var alldbRecipes = super.all();
	  for (a in alldbRecipes)
	  {
		  list.add(a.value);
	  }
	  trace("END");
	  return list;	  
  }
}